<template>
	<view>
		<button type="primary" @click="run">执行动画</button>
		<view :animation="animationData" style="background:red;height:100rpx;width:100rpx"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				animationData: {},
				show: true
			}
		},
		// async onShow() {
		// 	if (typeof this.$scope.getTabBar === 'function' && this.$scope.getTabBar()) {
		// 		this.$scope.getTabBar().setData({
		// 			selected: 0
		// 		})
		// 	}
		// },
		onReady() {

		},
		methods: {
			run: function() {
				var animation = uni.createAnimation({
					duration: 500,
					timingFunction: 'ease',
				})
				this.animation = animation
				if (this.show) {
					animation.translateY(-80).opacity(0).step()
				} else {
					animation.translateY(0).opacity(1).step()
				}
				this.show = !this.show
				this.animationData = animation.export()
			}
		}
	}
</script>

<style>

</style>